﻿using IOA.MES.Client.Common;
using System.Windows;

namespace IOA.MES.Client.Laminator
{
    /// <summary>
    /// WinPlcSetting.xaml 的交互逻辑
    /// </summary>
    public partial class WinPlcSetting : Window
    {
        public WinPlcSetting()
        {
            InitializeComponent();
            txtIpAddress.Text = BaseEnv.GetStorage("LaminatorIpAddress") ?? string.Empty;
            txtPort.Text = BaseEnv.GetStorage("LaminatorPort") ?? string.Empty;
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var ipAddress = txtIpAddress.Text.Trim();
            var port = txtPort.Text.Trim();

            BaseEnv.SetStorage("LaminatorIpAddress", ipAddress);
            BaseEnv.SetStorage("LaminatorPort", port);
            DialogResult = true;
            this.Close();
        }
    }
}
